<!DOCTYPE html>
<html>
<head>
    <title>Fried CS可视化</title>
    {{ bar | safe }}
</head>
<body>
    <h1>Shop Visualization</h1>
<!-- 在模板中直接使用渲染好的图表代码 -->
    {{ bar_embed | safe }}
    <script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>

    <script type="text/javascript">
           var bar = echarts.init(document.getElementById('main'));
            bar.setOption({{ bar.json | safe }});

            var shop_name_links = {{ shop_name_links | safe }};

            bar.on('click', function(params) {
                var index = params.dataIndex;
                var url = shop_name_links[index].url;
                if (url) {
                    window.location.href = url;
                }
            });
    </script>
</body>
</html>
